package com.zhentao.controller;

import com.zhentao.aliyun.WebSocketHandlerTest;
import com.zhentao.service.SpeechService;
import com.zhentao.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: SpeechController
 * @Author: 振涛教育_Q
 * @Date: 2024/12/4 13:59
 */
@RestController
@RequestMapping("/speech")
public class SpeechController {
    @Autowired
    private SpeechService speechService;
    @Autowired
    private WebSocketHandlerTest webSocketHandlerTest;

    /**
     * @description 开启语音
     * @author 振涛教育_小Q
     * @date    2024/12/4 14:01
     * @param
     * @return com.zhentao.utils.ResponseResult
     */
    @GetMapping("/search")
    public void speech(){
        speechService.speech();
    }


    /**
     * @description 关闭语音
     * @author 振涛教育_小Q
     * @date    2024/12/4 14:01
     * @param
     * @return com.zhentao.utils.ResponseResult
     */
    @GetMapping("/shutdown")
    public void shutdown(){
        // 关闭语音
        speechService.shutdown();
        // 关闭通信
        webSocketHandlerTest.close();
    }


}
